package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 其他入库单表，记录非采购等其他类型的入库业务
 * @TableName other_inbound
 */
@TableName(value ="other_inbound")
@Data
public class OtherInbound implements Serializable {
    /**
     * 主键ID，入库单的唯一标识，用于在系统中唯一确定一张其他入库单
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 入库单编号，入库单的唯一编号，方便业务人员管理和查询其他入库单
     */
    private String inboundNo;

    /**
     * 仓库ID，关联仓库表的ID，表明该入库业务发生在哪个仓库
     */
    private Long warehouseId;

    /**
     * 入库日期，产品进行入库的日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date inboundDate;

    /**
     * 状态，单据的状态，用于跟踪其他入库单的处理进度，如未审核、已审核等
     */
    private Integer status;

    /**
     * 总金额，该入库业务的总金额
     */
    private BigDecimal totalAmount;

    /**
     * 备注信息，用于记录与该其他入库单相关的额外说明，如入库原因等
     */
    private String remark;

    /**
     * 创建人
     */
    @TableField(exist = false)
    private Long createUser;

    /**
     * 创建时间，该其他入库单的创建时间，用于记录单据的创建顺序和时间
     */
    private Date createTime;

    /**
     * 租户ID，用于多租户环境下区分不同的租户，每个租户可以有自己独立的其他入库单体系
     */
    private Long tenantId;
    @TableField(exist = false)
    private String warehouseName;
    @TableField(exist = false)
    private List<OtherInboundItem> items;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        OtherInbound other = (OtherInbound) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getInboundNo() == null ? other.getInboundNo() == null : this.getInboundNo().equals(other.getInboundNo()))
            && (this.getWarehouseId() == null ? other.getWarehouseId() == null : this.getWarehouseId().equals(other.getWarehouseId()))
            && (this.getInboundDate() == null ? other.getInboundDate() == null : this.getInboundDate().equals(other.getInboundDate()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getTotalAmount() == null ? other.getTotalAmount() == null : this.getTotalAmount().equals(other.getTotalAmount()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getTenantId() == null ? other.getTenantId() == null : this.getTenantId().equals(other.getTenantId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getInboundNo() == null) ? 0 : getInboundNo().hashCode());
        result = prime * result + ((getWarehouseId() == null) ? 0 : getWarehouseId().hashCode());
        result = prime * result + ((getInboundDate() == null) ? 0 : getInboundDate().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getTotalAmount() == null) ? 0 : getTotalAmount().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getTenantId() == null) ? 0 : getTenantId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", inboundNo=").append(inboundNo);
        sb.append(", warehouseId=").append(warehouseId);
        sb.append(", inboundDate=").append(inboundDate);
        sb.append(", status=").append(status);
        sb.append(", totalAmount=").append(totalAmount);
        sb.append(", remark=").append(remark);
        sb.append(", createUser=").append(createUser);
        sb.append(", createTime=").append(createTime);
        sb.append(", tenantId=").append(tenantId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
